﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace LdtJudge.DataEngine.Model.XMLConfigModel.OptimzeMode
{
    /// <summary>
    /// 同节点数据配置
    /// </summary>
    [Serializable]
    [XmlRootAttribute("xmllabel", IsNullable = false)]
    public class OptimizeSameNodeXML
    {

        private string _Xmlpath;
        private string _Overall;
        private string _Code;
        private List<HandleType> _handleTypes = new List<HandleType>();
        /// <summary>
        /// 节点编号
        /// </summary>
        [XmlAttribute("code")]
        public string Code { get => _Code; set => _Code = value; }
        /// <summary>
        /// 节点处理方式如果为1则表示为整体处理
        /// </summary>
        [XmlAttribute("overall")]
        public string Overall { get => _Overall; set => _Overall = value; }
        /// <summary>
        /// 路径配置
        /// </summary>
        [XmlAttribute("xmlpath")]
        public string Xmlpath { get => _Xmlpath; set => _Xmlpath = value; }


        ///<summary>
        ///业务数据处理类型集合
        ///</summary> 
        [XmlElement("handletype")]
        public List<HandleType> HandleTypes { get => _handleTypes; set => _handleTypes = value; }

    }

    /// <summary>
    /// 20200722 ljx 添加当前节点处理类型
    /// </summary>
    [Serializable]
    [XmlRoot("handletype", IsNullable = false)]
    public class HandleType
    {
        private OptimizeNode _OptimizeNode = new OptimizeNode();
        private List<CurrentnoteAttr> _Currentnote = new List<CurrentnoteAttr>();

        ///<summary>
        /// 处理类型的编号
        ///</summary> 
        [XmlAttribute("code")]
        public string Code { get; set; }


        ///<summary>
        /// 业务处理类型名称
        ///</summary> 
        [XmlAttribute("name")]
        public string Name { get; set; }
        /// <summary>
        /// 节点标识
        /// </summary>
        [XmlElement("currentnote")]
        public List<CurrentnoteAttr> Currentnote { get => _Currentnote; set => _Currentnote = value; }
        /// <summary>
        /// 标识子节点信息
        /// </summary>
        [XmlElement("childnode")]
        public OptimizeNode OptimizeNode { get => _OptimizeNode; set => _OptimizeNode = value; }

    }


    /// <summary>
    /// 节点配置
    /// </summary>
    [Serializable]
    [XmlRootAttribute("childnode", IsNullable = false)]
    public class OptimizeNode
    {
        private string _Name;
        /// <summary>
        /// 节点名称
        /// </summary>
        [XmlAttribute("name")]
        public string Name { get => _Name; set => _Name = value; }
        /// <summary>
        /// 节点属性
        /// </summary>
        [XmlAttribute("element")]
        public string Element { get => _Element; set => _Element = value; }
        /// <summary>
        /// 节点属性
        /// </summary>
        private string _Element;
    }
    /// <summary>
    /// 标记节点配置
    /// </summary>
    [Serializable]
    [XmlRootAttribute("currentnote", IsNullable = false)]
    public class CurrentnoteAttr
    {
        /// <summary>
        /// 属性标识名称
        /// </summary>
        [XmlAttribute("name")]
        public string name { get; set; }
    }
}
